﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Travan.ServerServices;
using TravianAutoQueue.DomainModel;
using TravianAutoQueue.DomainModel.Enums;

namespace TravianMiniBot.Entities
{
    public class UpgradeAction: Action, IAction
    {

        #region IAction Members

        public Village TargetVillage { get; set; }
        public int Slot { get; set; }
        public BuildingType BuildingType { get; set; }
        public IVillageService VillageService { get; set; }

        public UpgradeAction(int slot, BuildingType type, Village village, IVillageService service)
        {
            TargetVillage = village;
            Slot = slot;
            BuildingType = type;
            VillageService = service;
        }

        public override TimeSpan Execute()
        {
            return VillageService.UpgradeBuilding(Slot, TargetVillage.TravianId, Program.session);
        }

        public override string Description
        {
            get { return string.Format("Upgrading {0} in {1}", BuildingType.ToString(), TargetVillage.Name); }
        }

        public override string ToString()
        {
            return Description;
        }
        #endregion
    }
}
